﻿using System;
using System.ComponentModel;
using Newtonsoft.Json;


namespace T.FAS.Runtime.Metadata.Entity
{
    /// <summary>
    /// Action元数据
    /// </summary>
    [JsonObject(MemberSerialization.OptOut)]
    [Serializable]
    public class MetaDataContent<T> : IMetaDataContent
    {
        #region 接口属性
        public string MetaDataID { get; set; }
        public string MetaDataCode { get; set; }
        public string MetaDataName { get; set; }
        public DateTime CreateTime { get; set; }
        public string Creator { get; set; }
        public DateTime LastModifyTime { get; set; }
        public string LastModifier { get; set; }
        public IMetaData MetaData { get; set; }
        #endregion
        public T MetaDataEntity { get; set; }
        #region 接口动作、事件
        //public Version CurrentVersion { get; set; }
        //public Version CompatibleMinVersion { get; set; }
        //public Version EngineVersion { get; set; }
        public string ProjectBranchID { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        public object Clone()
        {
            Type t = typeof(T);
            if (t.IsSubclassOf(typeof(ICloneable)))
            {
                return (MetaDataEntity as ICloneable).Clone();
            }
            else
                throw new Exception($"类型{t}不实现ICloneable接口");
        }
        #endregion
    }
}
